<template>
    <form :action="action" method="post" :enctype="hasFile?'multipart/form-data':'application/x-www-form-urlencoded'">
        <csrf-token-field/>
        <input type="hidden" name="_method" value="PUT" v-if="isUpdate">
        <input type="hidden" name="_method" value="DELETE" v-if="isDelete">
        <slot></slot>
    </form>
</template>

<script>
    export default {
        name: "TigForm",
        props: {
            action: {type: String, required: true},
            isUpdate: {default: false},
            isDelete: {type: Boolean, default: false},
            hasFile: {type: Boolean, default: false}
        }
    }
</script>

<style scoped>

</style>